
	mui.init({
				pullRefresh: {
					container: '#pullrefresh',
					up: {
						auto:false,
						contentrefresh: '正在加载...',
						callback: pullupRefresh
					}
				}
	});
	
	var userinfo = app.getState() || {};
    var uid = userinfo.user_id;
    var currenPage=1;
    var pageSize=12;
    var total_page=0;
    var total_count=0;
 
    window.onload = function(){
    	mui.ajax({
				url: apiurl + "User/accountLog/",
				data: {user_id:uid,'p':currenPage,'size':pageSize,'tab':2,'_token':userinfo.token},
				async: true,
				dataType: 'json',
				crossDomain: true, //强制使用5+跨域
				type: 'get',
				timeout: 10000,
				success: function(res) {
					console.log(JSON.stringify(res));
					// 请求成功
					if(res.status ==-3){
						mui.toast(res.msg);
						app.out();
						return false;
					} else {
						total_page=res.total_page;
						total_count=res.sum;
						var htm=get_data(res.resource);
						$('#pullrefresh .mui-scroll ul').append(htm);
						if(total_count==0){
							$('#pullrefresh .mui-scroll').append('<p style="text-align:center;">没有找到相关记录</p>');
						}
					}
				},
				error: function(xhr, type, errorThrown) {
					//console.log(JSON.stringify(xhr));
					//console.log(JSON.stringify(type));
					//console.log(JSON.stringify(errorThrown));
					mui.toast('获取数据失败！');
				}
			});
			
			mui.plusReady(function(){
			    //关闭等待框
			    plus.nativeUI.closeWaiting();
			    //显示当前页面
			    mui.currentWebview.show();
			});
    }

			
			
    function get_data(data){
    	var htm='';
		for(i in data) {
			/*
			 * <li class="mui-table-view-cell">
										<span>
											500
										</span>
										<span>
										17.668
										</span>
										<span>
											2018-05-01 18:18
										</span>
									</li>
			 */
			htm+='<li class="mui-table-view-cell">';
			htm+='<span>'+data[i]['from_name']+'</span>';
			htm+='<span>'+data[i]['val']+'</span>';
			htm+='<span>'+data[i]['add_time']+'</span>';
			htm+='</li>';
		}
		return htm;
    }


	function pullupRefresh() {
		setTimeout(function() {
			currenPage++;
			mui.ajax({
				url: apiurl + "User/accountLog/",
				data: {user_id:uid,'p':currenPage,'size':pageSize,'tab':2,'_token':userinfo.token},
				async: true,
				dataType: 'json',
				crossDomain: true, //强制使用5+跨域
				type: 'get',
				timeout: 10000,
				success: function(res) {
					console.log(JSON.stringify(res));
					// 请求成功
					if(res.status ==-3){
						mui.toast(res.msg);
						app.out();
						return false;
					}else {
						var htm=get_data(res.resource);
						$('#pullrefresh .mui-scroll ul').append(htm);
						if(currenPage < total_page){
	                        mui('#pullrefresh').pullRefresh().endPullupToRefresh(false);    /*能上拉*/
	                    }else{
	                        mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);/*不能上拉*/
	                    }
					}
				},
				error: function(xhr, type, errorThrown) {
					//console.log(JSON.stringify(xhr));
					//console.log(JSON.stringify(type));
					//console.log(JSON.stringify(errorThrown));
					mui.toast('获取数据失败！');
				}
			});

		}, 500);
	}
	